/*
2021-8-7
https://ac.nowcoder.com/acm/contest/11258/I
*/

#include<iostream>

using namespace std;
typedef long long ll;

int main()
{
    ll x,s;
    cin>>x>>s;
    ll res=0;
    for(int i=32;i>=0;i--)
    {
        int a=x>>i&1,b=s>>i&1;
        //cout<<i<<' '<<a<<' '<<b<<endl;
        if(a==1 && b==0)
        {
            cout<<0<<endl;
            return 0;
        }
        else if(a==1 && b==1)
        {
            if(res==0) res=2;
            else res*=2;
        }
    }
    if(x==s) res--;
    cout<<res<<endl;
    return 0;
}



